// 1、导入 vue 和 vue-router
import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入要用到的组件
const Goods = () => import('@/components/mainTab/goods/Goods')
const Ratings = () => import('@/components/mainTab/ratings/Ratings')
const Seller = () => import('@/components/mainTab/seller/Seller')


// 2、安装插件
Vue.use(VueRouter);

// 3、配置路径与组件的映射关系
const routes = [
  {
    path: '',
    redirect: '/goods'
  },
  {
    path: '/goods',
    component: Goods
  },
  {
    path: '/ratings',
    component: Ratings
  },
  {
    path: '/seller',
    component: Seller
  }
];


// 4、创建一个路由实例
const router = new VueRouter({
  routes,
  mode: 'history',
  linkActiveClass: 'active'
});

// 5、导出路由实例，便于 main.js 导入并挂载
export default router
